/**********************************************************
 * CategoryManagerAction.java.java
 *
 * Created by punam
 * Last modified Date: Sep 10, 2008 1:20:28 PM by punam
 * Revision: <svn revision #>
 * Version : 0.1
 * Copyright (c) 2008 - 2009 cyberThink Infotech Pvt. Ltd., All rights reserved.
 **********************************************************/
package com.printeverywhere.action;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.faces.application.Application;
import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.hibernate.HibernateException;
import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.exception.GenericJDBCException;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.printeverywhere.delegator.CategoryManagerServiceDelegator;
import com.printeverywhere.delegator.CommonFunctionDelegator;
import com.printeverywhere.delegator.LocationCategoriesServiceDelegator;
import com.printeverywhere.delegator.TranslationSystemServiceDelegator;
import com.printeverywhere.dto.CategoryType;
import com.printeverywhere.dto.GeneralCategories;
import com.printeverywhere.dto.LocationCategories;
import com.printeverywhere.interceptor.ApplicationContextInterceptor;
import com.printeverywhere.util.AdminConstants;
import com.printeverywhere.util.CommonUtil;
import com.printeverywhere.util.SearchCriteria;
import com.printeverywhere.util.SearchListCriteria;

public class CategoryManagerAction extends AdminSystemManagement {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	private List<GeneralCategories> generalCategoriesList;

	private List<GeneralCategories> generalCategoriesNamesList = new ArrayList<GeneralCategories>();
	private List<Integer> breadCrumbIdList = new ArrayList<Integer>();

	private List<CategoryType> categoryTypesList = new ArrayList<CategoryType>();

	private GeneralCategories generalCategories = new GeneralCategories();

	private Map<Integer, GeneralCategories> generalCategoriesMap;

	private static Logger logger = Logger
			.getLogger(CategoryManagerAction.class);

	private String categoryArea;

	private int templateSelectedOptions;

	private int iconSelectedOptions;

	private HttpServletRequest request;

	private Integer categoryId;

	private Integer parentCategoryId = 0;

	private Boolean categoryTeaser = AdminConstants.FALSE;

	private CategoryType type;

	private Long sortOrder = 0L;

	private String categoryName;

	private String description = AdminConstants.BLANK;

	private Boolean active = AdminConstants.FALSE;

	private Boolean accept = AdminConstants.FALSE;

	private Boolean adult = AdminConstants.FALSE;

	private Boolean domain = AdminConstants.FALSE;

	private Boolean login = AdminConstants.FALSE;

	private String icon = AdminConstants.BLANK;

	private String format = AdminConstants.BLANK;

	private String template = AdminConstants.BLANK;

	private String languageCode = AdminConstants.BLANK;

	private String metaTitle = AdminConstants.BLANK;

	private String metaDescription = AdminConstants.BLANK;

	private String metaKeywords = AdminConstants.BLANK;

	private boolean subCategory = false;

	private String parentId="";

	private List<String> generalCategoriesToDelete = new ArrayList<String>();
	private List<GeneralCategories> tempGeneralCategoriesList;
	private List<GeneralCategories> tempList = new ArrayList<GeneralCategories>();
	/*
	 * (non-Javadoc)
	 *
	 * @see com.opensymphony.xwork2.ActionSupport#execute()
	 */
	public String execute() throws Exception {
		try {
			logger.info(AdminConstants.IN_EXECUTE_METHOD);
			getAllCategories();
			displayGeneralCategories();
		} catch (HibernateException e) {
			logger.error(AdminConstants.ERROR_IN_DISPLAYING_THE_RECORD
					+ e.getMessage());
			return INPUT;
		}
		return SUCCESS;
	}

	public static void main(String[] args) {
		SearchListCriteria searchListCriteria = new SearchListCriteria();
		searchListCriteria.setOrderBy(AdminConstants.SORTORDER);
		searchListCriteria.setAsc(AdminConstants.TRUE);
		List<GeneralCategories> generalCategoriesList = new ArrayList<GeneralCategories>();
		generalCategoriesList = CategoryManagerServiceDelegator
				.getList(searchListCriteria);
		System.out.println(" ... generalCategoriesList ... "
				+ generalCategoriesList.size());
	}

	/**
	 * setForUpdateGeneralCategory method populates the generalCategory object
	 * with the given categoryId value.
	 *
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public String setForUpdateGeneralCategory() {
		try {
			if (categoryId != null) {
				generalCategories = getGeneralCategoriesFromCategoryId(categoryId);
				setAttributeFromGeneralCategories();
				GeneralCategories mainParentGeneralCategories = new GeneralCategories();
				if(generalCategories.getMainParentId() != null){
					mainParentGeneralCategories = getGeneralCategoriesFromCategoryId(generalCategories.getMainParentId());
				}else{
					mainParentGeneralCategories = getGeneralCategoriesFromCategoryId(generalCategories.getCategoryId());
				}
				breadCrumbIdList = CategoryManagerServiceDelegator
				.getBreadCrumbList( generalCategories, mainParentGeneralCategories);
				for (Iterator iterator = breadCrumbIdList.iterator(); iterator.hasNext();) {
					int id = Integer.parseInt(iterator.next().toString());
					 GeneralCategories generalCategories = getGeneralCategoriesFromCategoryId(id);
					generalCategoriesNamesList.add(generalCategories);
				}// auctionCategoriesMeta =
				// CategoryManagerServiceDelegator.getAuctionCategoriesMeta(categoryId);
				// auctionCategoriesMeta.se
			}
		} catch (HibernateException e) {
			logger
					.error(AdminConstants.ERROR_IN_DISPLAYING_THE_RECORD_FOR_GIVEN_CATEGORYID
							+ e.getMessage());
			return INPUT;
		}
		return SUCCESS;
	}

	/**
	 * Updates the generalCategory object with updated generalCategories value.
	 *
	 * @return
	 */
	public String updateGeneralCategory() {
		try {
			setAttributeToGeneralCategories();
			// Set icon value as per user selection from combobox
			String status = CategoryManagerServiceDelegator.updateIconValue(
					categoryId, iconSelectedOptions, icon);
			updateSequenceLevelMainParentValues(parentCategoryId,
					AdminConstants.EDIT);
			if (status.equals(AdminConstants.BLANK)) {
				generalCategories.setIcon(icon);
			}

			// Set template value as per user selection from combobox
			status = AdminConstants.NONE;
			status = CategoryManagerServiceDelegator.updateTemplateValue(
					categoryId, templateSelectedOptions, icon);
			if (status.equals(AdminConstants.BLANK)) {
				generalCategories.setTemplate(template);
			}
			if(generalCategories.getSortOrder().equals(AdminConstants.NONE)){
				generalCategories.setSortOrder(Long.valueOf(AdminConstants.ZERO_NUMBER));
			}
			if(generalCategories.getCategoryName().equals(AdminConstants.NONE)){
				addActionError("Category Name required.".intern());
				logger.error(AdminConstants.ERROR_IN_UPDATING_THE_RECORD);
				return INPUT;
			}
			CategoryManagerServiceDelegator.update(generalCategories);
		}catch (ConstraintViolationException e) {
			addActionError("Category Name already exist: " + categoryName);
			logger.error(AdminConstants.ERROR_IN_UPDATING_THE_RECORD
					+ e.getMessage());
			return INPUT;
		}catch (HibernateException e) {
			addActionError("Enter Category Name upto 50 characters.");
			logger.error(AdminConstants.ERROR_IN_UPDATING_THE_RECORD
					+ e.getMessage());
			return INPUT;
		}catch (NullPointerException e) {
			addActionError("Enter value for parentcategoryid".intern());
			logger.error(AdminConstants.ERROR_IN_UPDATING_THE_RECORD
					+ e.getMessage());
			return INPUT;
		}

		return SUCCESS;
	}

	/**
	 * displayAllGeneralCategory method will display all the categories and its
	 * sub-categories for given categoryId.
	 *
	 * @return
	 */
	public String displayAllGeneralCategory() {
		logger.info("In displayAllGeneralCategory method".intern());
		try {
			deleteCategories();
		} catch (HibernateException e) {
			addActionError("Error in displaying records for category manager."
					.intern());
			logger.error(AdminConstants.ERROR_IN_DISPLAYING_THE_RECORD
					+ e.getMessage());
			return INPUT;
		}

		return SUCCESS;
	}

	/**
	 * Adds new generalCategory as per the value(s) in categoryArea.
	 *
	 * @return
	 */
	public String addNewGeneralCategories() {
		logger.info("In addNewGeneralCategories method. ");
		try {
			// Splits the categoryArea by new to add new categories.
			String[] categories = categoryArea.split(AdminConstants.NEW_LINE);
			for (int index = 0; index < categories.length; index++) {
				if (categories[index].trim().length() > 0) {
					categoryName = categories[index].trim();
					setAttributeToGeneralCategories();
					type = new CategoryType();
					type.setId(AdminConstants.ONE_NUMBER);
					generalCategories.setGeneralCategories(generalCategories);
					generalCategories.setLevel(AdminConstants.ONE_NUMBER);
					// Adds the maximum sequence to newly added general
					// category.
					generalCategories
							.setSequence(CategoryManagerServiceDelegator
									.getMaxSequence() + 1);
					// Sets the ParentCategory in case new category is added
					// under
					// any category.
					if (categoryId != null) {
						parentId = generalCategories.getGeneralCategories().getCategoryId().toString();
						GeneralCategories generalCategoriesParent = getGeneralCategoriesFromCategoryId(categoryId);
						updateSequenceLevelMainParentValues(
								generalCategoriesParent.getCategoryId(),
								AdminConstants.ADD);
					}
					CategoryManagerServiceDelegator.add(generalCategories);
					// Setting mainParentId
					if (generalCategories.getMainParentId() == null) {
						generalCategories.setMainParentId(generalCategories
								.getCategoryId());
						CategoryManagerServiceDelegator
								.update(generalCategories);
					}

					logger.info(AdminConstants.NEW_CATEGORY_INSERTED);
				}
				else{
					displayGeneralCategories();
					addActionError("Please, Enter category-name.");
					return INPUT;
				}
			}
		} catch (GenericJDBCException e) {
			displayGeneralCategories();
			addActionError("Enter Category Name upto 50 characters.");
			logger.error(AdminConstants.RECORD_NOT_ADDED + e.getMessage());
			return INPUT;
		} catch (ConstraintViolationException e) {
			displayGeneralCategories();
			addActionError("Category Name already exist: " + categoryName);
			logger.error(AdminConstants.RECORD_NOT_ADDED + e.getMessage());
			return INPUT;
		} catch (HibernateException e) {
			displayGeneralCategories();
			addActionError("Enter Proper Data.");
			logger.error(AdminConstants.RECORD_NOT_ADDED + e.getMessage());
			return INPUT;
		}
		return SUCCESS;
	}

	/**
	 * displayAllGeneralCategoryForEdit populates list for all the
	 * generalCategories. Displays all the parent categories name to edit.
	 *
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public String displayAllGeneralCategoryForEdit() {
		logger.info("In displayAllGeneralCategoryForEdit method.");
		try {
			getAllCategories();
			displayGeneralCategories();
			this.generalCategoriesMap = new HashMap<Integer, GeneralCategories>();
			for (GeneralCategories generalCategories : generalCategoriesList) {
				this.generalCategoriesMap.put(
						generalCategories.getCategoryId(), generalCategories);
			}
		} catch (HibernateException e) {
			addActionError("Error in displaying all the general categories for edit."
					.intern());
			logger.error(e.getMessage());
			return INPUT;
		}
		return SUCCESS;
	}

	/**
	 * deleteGeneralCategory method deletes all category for where categoryId,
	 * mainParentId, parentCategoryId matches for given id.
	 *
	 * @return
	 */
	public String deleteGeneralCategory() {
		logger.info("In deleteGeneralCategory method.".intern());
		// Deletes all category for where categoryId, mainParentId,
		// parentCategoryId matches for given id.
		try {
			if (categoryId != null) {
				CategoryManagerServiceDelegator.delete(categoryId);
			}
		}catch (ConstraintViolationException e) {
			addActionError("You can not delete this category due to constraint violation."+categoryId);
			logger.error(AdminConstants.ERROR_IN_DELETING_THE_RECORD
					+ e.getMessage());
			deleteCategories();
			return INPUT;
		} catch (HibernateException e) {
			addActionError(AdminConstants.ERROR_IN_DELETING_THE_RECORD);
			logger.error(AdminConstants.ERROR_IN_DELETING_THE_RECORD
					+ e.getMessage());
			deleteCategories();
			return INPUT;
		}
		return SUCCESS;
	}

	/**
	 * Updates all the generalCategory names edited.
	 *
	 * @return
	 */
	public String updateAllGeneralCategory() {
		logger.info("In updateAllGeneralCategory method.");
		try {
			for (GeneralCategories generalCategories : this
					.getGeneralCategoriesMap().values()) {
				this.generalCategories = generalCategories;
				CategoryManagerServiceDelegator.update(generalCategories);
			}
		} catch (ConstraintViolationException e) {
			getAllCategories();
			displayGeneralCategories();
			addActionError("Category Name already exist: " + categoryName);
			logger.error(AdminConstants.ERROR_IN_UPDATING_THE_RECORD
					+ e.getMessage());
			return INPUT;
		}catch (HibernateException e) {
			getAllCategories();
			displayGeneralCategories();
			addActionError("Enter Category Name upto 50 characters: "+ this.generalCategories.getCategoryName());
			logger.error(AdminConstants.ERROR_IN_UPDATING_THE_RECORD
					+ e.getMessage());
			return INPUT;
		}
		return SUCCESS;
	}

	public void setAttributeToGeneralCategories() {
		int id = parentCategoryId == 0 ? 1 : parentCategoryId;
		this.generalCategories.setCategoryId(categoryId);
		this.generalCategories.setCategoryName(categoryName);
		this.generalCategories.setCategoryTeaser(categoryTeaser);
		this.generalCategories.setDescription(description);
		this.generalCategories.setSortOrder(sortOrder);
		this.generalCategories
				.setGeneralCategories(getGeneralCategoriesFromCategoryId(id));
		this.generalCategories.setCategoryType(type);
		this.generalCategories.setAccept(accept);
		this.generalCategories.setActive(active);
		this.generalCategories.setAdult(adult);
		this.generalCategories.setDomain(domain);
		this.generalCategories.setLogin(login);
		this.generalCategories.setIcon(icon);
		this.generalCategories.setFormat(format);
		this.generalCategories.setTemplate(template);
		this.generalCategories.setMetaDescription(metaDescription);
		this.generalCategories.setMetaKeywords(metaKeywords);
		this.generalCategories.setMetaTitle(metaTitle);
	}

	public void setAttributeFromGeneralCategories() {
		categoryId = generalCategories.getCategoryId();
		parentCategoryId = generalCategories.getGeneralCategories()
				.getCategoryId();
		categoryName = generalCategories.getCategoryName();
		categoryTeaser = generalCategories.getCategoryTeaser();
		description = generalCategories.getDescription();
		sortOrder = generalCategories.getSortOrder();
		type = generalCategories.getCategoryType();
		accept = generalCategories.getAccept();
		active = generalCategories.getActive();
		adult = generalCategories.getAdult();
		login = generalCategories.getLogin();
		domain = generalCategories.getDomain();
		icon = generalCategories.getIcon();
		format = generalCategories.getFormat();
		template = generalCategories.getTemplate();
		metaDescription = generalCategories.getMetaDescription();
		metaKeywords = generalCategories.getMetaKeywords();
		metaTitle = generalCategories.getMetaTitle();
	}

	public void getAllCategories(){
		tempGeneralCategoriesList = (List<GeneralCategories>) ActionContext.getContext().getApplication().get(AdminConstants.GENERALCATEGORIES);
	}
	/**
	 *
	 * @return
	 * @return
	 */

	public void displayGeneralCategories() {
		getAllCategories();
		// if Parent is selected categoryid will not be null.
		if (categoryId != null) {
			subCategory = true;
			logger.info("Subcateogries for category : ".intern() + categoryId);
			tempList.clear();
			for (Iterator<GeneralCategories> iterator = tempGeneralCategoriesList.iterator(); iterator
					.hasNext();) {
				GeneralCategories mainGeneralCategories = (GeneralCategories) iterator
						.next();
				if (categoryId.equals(mainGeneralCategories.getCategoryId())) {
					GeneralCategories tempGeneralCategories = mainGeneralCategories;
					for (Iterator<GeneralCategories> subCategoriesIterator = tempGeneralCategories
							.getGeneralCategorieses().iterator(); subCategoriesIterator
							.hasNext();) {
						GeneralCategories subGeneralCategories = (GeneralCategories) subCategoriesIterator
								.next();
						if (!categoryId.equals(subGeneralCategories.getCategoryId())) {
							tempList.add(subGeneralCategories);
						}
					}
				}
			}
			generalCategories = getGeneralCategoriesFromCategoryId(categoryId);
			GeneralCategories mainParentGeneralCategories = new GeneralCategories();
			if(generalCategories.getMainParentId() != null){
				mainParentGeneralCategories = getGeneralCategoriesFromCategoryId(generalCategories.getMainParentId());
			}else{
				mainParentGeneralCategories = getGeneralCategoriesFromCategoryId(generalCategories.getCategoryId());
			}
			breadCrumbIdList = CategoryManagerServiceDelegator
			.getBreadCrumbList( generalCategories, mainParentGeneralCategories);
			for (Iterator iterator = breadCrumbIdList.iterator(); iterator.hasNext();) {
				int id = Integer.parseInt(iterator.next().toString());
				 GeneralCategories generalCategories = getGeneralCategoriesFromCategoryId(id);
				generalCategoriesNamesList.add(generalCategories);
			}

			logger.info(" categoryName size : " + generalCategoriesNamesList.size());
		} else {
			tempList.clear();
			for (Iterator iterator = tempGeneralCategoriesList.iterator(); iterator
					.hasNext();) {
				GeneralCategories tempGeneralCategories = (GeneralCategories) iterator
						.next();
				if (tempGeneralCategories.getLevel() == AdminConstants.ONE_NUMBER){
					tempList.add(tempGeneralCategories);
				}
			}
		}
		generalCategoriesList = tempList;
		logger.info("generalCategoriesList size : ".intern()
				+ generalCategoriesList.size());
	}

	public void deleteCategories(){
		if (categoryId != null) {
			generalCategories = getGeneralCategoriesFromCategoryId(categoryId);
			String display = AdminConstants.NONE
					+ generalCategories.getCategoryName()
					+ AdminConstants.OPEN_PARENTHESE
					+ (generalCategories.getGeneralCategorieses().size() > 0 ? generalCategories
							.getGeneralCategorieses().size() - 1
							: 0) + AdminConstants.CLOSE_PARENTHESE;
			generalCategoriesToDelete.add(display);
			generalCategoriesToDelete = CategoryManagerServiceDelegator
					.show(generalCategories, AdminConstants.THREE_DASHES,
							generalCategoriesToDelete);
			logger
					.info(" List size of the general categories object to be deleted : "
							.intern()
							+ generalCategoriesToDelete.size());
		}
	}

	public void updateSequenceLevelMainParentValues(int categoryid,
			String addEdit) {
		GeneralCategories tempGeneralCategories = getGeneralCategoriesFromCategoryId(this.categoryId);
		int sequence = 0;
		int level = 0;
		int mParentId = 0;
		// Sets the sequence value of location_categories table.
		int max_sequence = CategoryManagerServiceDelegator
				.getMaxOfChildSequence(categoryid, this.categoryId);
		if (max_sequence == 0) {
			sequence = CategoryManagerServiceDelegator
					.getParentSequence(categoryid);
		} else {
			sequence = max_sequence;
		}
		// Gets the level of the parentCategoryId.
		level = CategoryManagerServiceDelegator
				.getLevelForGivenCategoryId(categoryid);
		level = level + 1;
		if (addEdit.equals(AdminConstants.EDIT)) {
			if (categoryid == categoryId) {
				level = 1;
			}
		}
		generalCategories.setLevel(level);
		sequence = sequence + 1;
		generalCategories.setSequence(sequence);

		// Set the parentCategoryId.
		generalCategories.setGeneralCategories(getGeneralCategoriesFromCategoryId(categoryid));

		// For mainParentId is null than parentId is mainParentId.
		if (tempGeneralCategories.getMainParentId() == null) {
			mParentId = categoryid;
		} // For parentCategoryId and categoryId are same.
		else if (generalCategories.getGeneralCategories().getCategoryId() == generalCategories
				.getCategoryId()
				&& addEdit.equals(AdminConstants.EDIT)) {
			mParentId = tempGeneralCategories.getCategoryId();
		} // In case main parentId is not null.
		else {
			GeneralCategories tempGeneralCategoriesForMpid = getGeneralCategoriesFromCategoryId(categoryid);
			mParentId = tempGeneralCategoriesForMpid.getMainParentId();
		}

		generalCategories.setMainParentId(mParentId);

		// Update all the current sequences starting from sequence.
		CategoryManagerServiceDelegator.updateSequences(sequence);
	}

	public GeneralCategories getGeneralCategoriesFromCategoryId(int categoryid){
		 try{
		 tempGeneralCategoriesList = (List<GeneralCategories>) ActionContext.getContext().getApplication().get(AdminConstants.GENERALCATEGORIES);
			GeneralCategories type = new GeneralCategories();
			for (Iterator<GeneralCategories> iterator = tempGeneralCategoriesList.iterator(); iterator.hasNext();) {
				type = (GeneralCategories) iterator.next();
				if(categoryid == type.getCategoryId()){
					return type;
				}
			}
		 }catch (Exception e) {
			 addActionError(e.getMessage());
		}
			return null;
	 }

	public List<GeneralCategories> getGeneralCategoriesList() {
		return generalCategoriesList;
	}

	public void setGeneralCategoriesList(
			List<GeneralCategories> generalCategoriesList) {
		this.generalCategoriesList = generalCategoriesList;
	}

	public GeneralCategories getGeneralCategories() {
		return generalCategories;
	}

	public void setGeneralCategories(GeneralCategories generalCategories) {
		this.generalCategories = generalCategories;
	}

	public Map<Integer, GeneralCategories> getGeneralCategoriesMap() {
		return generalCategoriesMap;
	}

	public void setGeneralCategoriesMap(
			Map<Integer, GeneralCategories> generalCategoriesMap) {
		this.generalCategoriesMap = generalCategoriesMap;
	}

	public String getCategoryArea() {
		return categoryArea;
	}

	public void setCategoryArea(String categoryArea) {
		this.categoryArea = categoryArea;
	}

	public HttpServletRequest getRequest() {
		return request;
	}

	public void setRequest(HttpServletRequest request) {
		this.request = request;
	}

	public int getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(int categoryId) {
		this.categoryId = categoryId;
	}

	public List<GeneralCategories> getGeneralCategoriesNamesList() {
		return generalCategoriesNamesList;
	}

	public void setGeneralCategoriesNamesList(
			List<GeneralCategories> generalCategoriesNamesList) {
		this.generalCategoriesNamesList = generalCategoriesNamesList;
	}

	public Long getSortOrder() {
		return sortOrder;
	}

	public void setSortOrder(Long sortOrder) {
		this.sortOrder = sortOrder;
	}

	public String getCategoryName() {
		return categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getFormat() {
		return format;
	}

	public void setFormat(String format) {
		this.format = format;
	}

	public String getTemplate() {
		return template;
	}

	public void setTemplate(String template) {
		this.template = template;
	}

	public void setCategoryId(Integer categoryId) {
		this.categoryId = categoryId;
	}

	public Integer getParentCategoryId() {
		return parentCategoryId;
	}

	public void setParentCategoryId(Integer parentCategoryId) {
		this.parentCategoryId = parentCategoryId;
	}

	public Boolean getCategoryTeaser() {
		return categoryTeaser;
	}

	public void setCategoryTeaser(Boolean categoryTeaser) {
		this.categoryTeaser = categoryTeaser;
	}

	public Boolean getActive() {
		return active;
	}

	public void setActive(Boolean active) {
		this.active = active;
	}

	public Boolean getAccept() {
		return accept;
	}

	public void setAccept(Boolean accept) {
		this.accept = accept;
	}

	public Boolean getAdult() {
		return adult;
	}

	public void setAdult(Boolean adult) {
		this.adult = adult;
	}

	public Boolean getDomain() {
		return domain;
	}

	public void setDomain(Boolean domain) {
		this.domain = domain;
	}

	public Boolean getLogin() {
		return login;
	}

	public void setLogin(Boolean login) {
		this.login = login;
	}

	public String getLanguageCode() {
		return languageCode;
	}

	public void setLanguageCode(String languageCode) {
		this.languageCode = languageCode;
	}

	public String getMetaTitle() {
		return metaTitle;
	}

	public void setMetaTitle(String metaTitle) {
		this.metaTitle = metaTitle;
	}

	public String getMetaDescription() {
		return metaDescription;
	}

	public void setMetaDescription(String metaDescription) {
		this.metaDescription = metaDescription;
	}

	public String getMetaKeywords() {
		return metaKeywords;
	}

	public void setMetaKeywords(String metaKeywords) {
		this.metaKeywords = metaKeywords;
	}

	public List<String> getGeneralCategoriesToDelete() {
		return generalCategoriesToDelete;
	}

	public void setGeneralCategoriesToDelete(
			List<String> generalCategoriesToDelete) {
		this.generalCategoriesToDelete = generalCategoriesToDelete;
	}

	public int getTemplateSelectedOptions() {
		return templateSelectedOptions;
	}

	public void setTemplateSelectedOptions(int templateSelectedOptions) {
		this.templateSelectedOptions = templateSelectedOptions;
	}

	public int getIconSelectedOptions() {
		return iconSelectedOptions;
	}

	public void setIconSelectedOptions(int iconSelectedOptions) {
		this.iconSelectedOptions = iconSelectedOptions;
	}

	public CategoryType getType() {
		return type;
	}

	public void setType(CategoryType type) {
		this.type = type;
	}

	public List<CategoryType> getCategoryTypesList() {
		return categoryTypesList;
	}

	public void setCategoryTypesList(List<CategoryType> categoryTypesList) {
		this.categoryTypesList = categoryTypesList;
	}

	public boolean isSubCategory() {
		return subCategory;
	}

	public void setSubCategory(boolean subCategory) {
		this.subCategory = subCategory;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}
}